package com.myjavalab.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class JDBCTest {

	public static void main(String[] args) {

		String driver = "com.mysql.jdbc.Driver";
		String url = "jdbc:mysql://localhost:3306/xiaoyaonv";
		String username = "root";
		String password = "password";
		try {
			Class.forName(driver);
			Connection con = DriverManager.getConnection(url, username, password);
			Statement stmt = con.createStatement();
			ResultSet rs = stmt.executeQuery("SELECT * FROM user");
			while (rs.next()) {
				System.out.println(rs.getInt(1)+rs.getString(2)+rs.getString(3));
			}
		} catch (Exception e) {

			e.printStackTrace();
		}
	}
}
